<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>js练习</title>
</head>
<body>
    <div>
        <select name="y" id="y">
            <script type="text/javascript">
                for(var i=2000;i<2020;i++){
                    document.write("<option value='"+i+"'>"+i+"</option>");
                }
            </script>
        </select>
        <button onclick="isrunyear()">判断</button>
    </div>
</body>
<script>
    function isrunyear() {
        var year = document.getElementById("y");
        // console.log(year);
        if((year.value%4==0&&year.value%100!=0)||(year.value%400==0)){
            alert("是闰年");
        }else{
            alert("不是闰年");
        }
    }
</script>
</html>